const koa = require('koa')
const path = require('path')
const render = require('koa-art-template')
const static = require('koa-static')
const bodyparser = require('koa-bodyparser')

const get = require('./router/get')
const post = require('./router/post')

const app = new koa()

app.use(bodyparser())
app.use(static(__dirname))

render(app, {
    root: path.join(__dirname, 'views'),
    extname: '.html',
    debug: process.env.NODE_ENV !== 'production'
})

app.use(get.routes()).use(post.routes())

app.listen(666, () => { 
    console.log('Server is runnning on port 666')
})